﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using OFB.BLL.Context;
using OFB.BLL.ViewModel;

namespace OFB.BLL.Repository
{
    public class FeedbackAnswerBLL : IFeedbackAnswerBLL
    {
        private readonly FeedbackkContext context;

        public FeedbackAnswerBLL()
        {
            context = new FeedbackkContext();
        }

        public FeedbackAnswerViewModel Search(int fbDetailId)
        {
            return context.FeedbackAnswerViewModel.Init("FeedbackAnswer_Search", context.FeedbackAnswerViewModel.BuildParameter("FbDetailId", DbType.Int32, fbDetailId))
                                                .Map()
                                                .Get();
        }

        public ICollection<FeedbackAnswerViewModel> Filter(int feedbackId, int type, string txtsearch, int IsFinished)
        {
            return context.FeedbackAnswerViewModel.Init("FeedbackAnswer_Filter",
                context.FeedbackAnswerViewModel.BuildParameter("FbId", DbType.Int32, feedbackId),
                context.FeedbackAnswerViewModel.BuildParameter("Type", DbType.Int32, type),
                context.FeedbackAnswerViewModel.BuildParameter("TxtSearch", DbType.String, txtsearch),
                context.FeedbackAnswerViewModel.BuildParameter("IsFinished", DbType.UInt32, IsFinished))
                                            .MapCollection<FeedbackAnswerViewModel>()
                                            .GetCollection();
        }
    }
}
